<template>
	<el-breadcrumb  style="padding: 30px;">
	   <el-breadcrumb-item>首页</el-breadcrumb-item>
	   <el-breadcrumb-item>小程序数据</el-breadcrumb-item>
	   <el-breadcrumb-item>抽奖数据</el-breadcrumb-item>
	</el-breadcrumb>
  <div>
   
    <el-table class="mb20" :data="tableData" border style="width: 100%">
	  
      <el-table-column prop="numbers" label="手机号码" width="120" />
      <el-table-column prop="name" label="姓名" width="120" />
      <el-table-column
	          prop="img"
	          label="头像"
	          width="100"      
	        >
	          <template #default="scope">		  
	              <el-image
	                  style="width: 100px; height: 100px"
	                  :src="scope.row.headurl"
	                  :preview-src-list="[scope.row.headurl]"
	                >
	                </el-image>
	          </template>
	        </el-table-column>
      
      
      <el-table-column prop="status" label="状态">
        <template #default="scope">
			<el-tag
			    :type="scope.row.zjorders==1?'success':''"
			    effect="dark">
			   {{ scope.row.zjorders==1 ? "已中奖" : "未中奖" }}
			  </el-tag>  
        </template>
      </el-table-column>
	  
	  
      
    </el-table>
	<el-dialog   v-model="msgshow" title="备注">
		<el-form :inline="true" class="demo-form-inline">
			<el-form-item label=""  >
				<el-input v-model="beizu" autocomplete="off"></el-input>
			</el-form-item>
		
			
			<el-form-item>
			   <el-button @click="msgsubmit" type="primary" >确定</el-button>
			 </el-form-item>
		</el-form>
	</el-dialog>
	
	<el-dialog   v-model="rankshow" title="排行榜">
		<el-table class="mb20" :data="tableData" border style="width: 100%">
		  <el-table-column prop="numbers" label="试驾人手机号码" />
		  <el-table-column prop="name" label="试驾人姓名" />
		 <el-table-column prop="type" label="试驾车型" />
		  <el-table-column prop="city" label="城市" />
		  <el-table-column prop="jifen" label="积分" />
		  
		</el-table>
	</el-dialog>
	<el-dialog   v-model="rankshows" title="反馈">
		<el-descriptions v-if="viewdata&&viewdata.cpsseven" title="s7反馈">
			
		   <el-descriptions-item  v-for="t in viewdata.cpsseven.split(',')" label="">{{t}}</el-descriptions-item>
		  
		</el-descriptions>
		<el-descriptions v-if="viewdata&&viewdata.cpilike" title="ilike反馈">
			
		   <el-descriptions-item  v-for="t in viewdata.cpilike.split(',')" label="">{{t}}</el-descriptions-item>
		  
		</el-descriptions>
		<el-descriptions v-if="viewdata&&viewdata.cpionex" title="ionex反馈">
			
		   <el-descriptions-item  v-for="t in viewdata.cpionex.split(',')" label="">{{t}}</el-descriptions-item>
		  
		</el-descriptions>
		<el-descriptions v-if="viewdata&&viewdata.cponexs" title="ionexP反馈">
			
		   <el-descriptions-item  v-for="t in viewdata.cponexs.split(',')" label="">{{t}}</el-descriptions-item>
		  
		</el-descriptions>
	</el-dialog>
    <el-pagination
      class="mt20"
      v-model:currentPage="page"
      @current-change="getData"
      :page-size="10"
      background
      layout="prev, pager, next"
      :total="total"
    >
    </el-pagination>
  </div>
</template>

<script>
import { ElMessageBox, ElMessage } from "element-plus";
export default {
  components: {},
  watch: {
    times() {
      this.form.starttime = this.times[0];
      this.form.endtime = this.times[1];
    },
	type(){
		this.page=1;
		this.getData();
	},
	jifen(){
		this.page=1;
		this.getData();
	},
	sjstatus(){
		if(this.sjstatus==''){
			 this.wdhx='';
			 this.ishexiao="";
			 this.fk="";	 
		}
		if(this.sjstatus==1){
			 this.wdhx=1;
			 this.ishexiao="";
			 this.fk="";	 
		}
		if(this.sjstatus==2){
			 this.wdhx="";
			 this.ishexiao=2;
			 this.fk="";	 
		}
		if(this.sjstatus==3){
			 this.wdhx="";
			 this.ishexiao="";
			 this.fk=3;	 
		}
		if(this.sjstatus==4){
			 this.wdhx=0;
			 this.ishexiao="";
			 this.fk="";	 
		}
		this.page=1;
		this.getData()
	}
  },
  data() {
    return {
		jifen:null,
		msgshow:false,
		typename:{
			"s7":'s7',
			"ilike":"i-like",
			"ionex":"i-onex",
			"ionexs":"i-onexP"
			
		},
		dataf:0,
		token:0,
		rankshows:false,
		rankshow:false,
		beizu:"",
      status: {
        0: "审核中",
        1: "正常",
        2: "隐藏",
        3: "不通过",
      },
	  type:null,
	  sjstatus:null,
	  wdhx:"",//   已核销 
	  ishexiao:"",// 已试驾
	  fk:"",//已反馈
      viewarr: [],
      modalStatewins: false,
      hdqtxmname: "", //     名称
      hdjifen: "", //   加积分
      numbers: "", //  手机
      modalStatewin: false,
      qrcode: null,
      modalStatecode: false,
      vtimes: ["", ""],
      formLabelWidth: "120px",
      times: "",
      form: {
        is_show: "1",
        images: "",
        content: "",
        jifen: "",
        starttime: "",
        endtime: "",
        title: "",
        is_hot: "0",
        author: "0",
      },
      tableData: [],
      rules: {
        title: [
          {
            required: true,
            message: "请填写标题",
            trigger: "blur",
          },
        ],
        jifen: [
          {
            required: true,
            message: "请填写积分",
            trigger: "blur",
          },
        ],
        content: [
          {
            required: true,
            message: "请填写内容",
            trigger: "blur",
          },
        ],
        starttime: [
          {
            required: true,
            message: "请选择时间",
            trigger: "change",
          },
        ],
      },
      pid: [],
      bqlist: [],
	  viewdata:"",
    };
  },
  async mounted() {
    // await this.$http.post("index.php/index/Admins/bqlist").then((data) => {
    //   this.bqlist = data;
    // });
    await this.getData();
  },
  methods: {
	  views(data){
		  console.log(data);
		  this.viewdata=data.row;
		  this.rankshows=true;
	  },
    getDatas(){
      this.page=1;
      this.getData()
    },
	msgsubmit(){
		this.$http
		  .post("/index.php/index/goodses/beizu", {beizu:this.beizu,id:this.id}).then(()=>{
			  this.beizu="";
			  ElMessage({
			    message: "编辑成功" ,
			    type: "success",
			  });
			  this.msgshow=false;
			  this.getData();
		  })
	},
    getData() {
      this.$http
        .post("/index.php/index/index/cjzrs", {
          page: this.page,
          pagesize: 10,
       
        })
        .then((datas) => {
			console.log(datas)
			this.dataf=datas[1];
			
			this.total=datas[1];
			
			this.tableData =datas[0];
          // if(datas.length>0){
          // var data = datas[0];
          // this.tableData = data;
          // this.total = datas[1];
          // }else{
          //   this.tableData = [];
          //    this.total = 0;
          // }
         
        });
    },
    submit(ref) {
      console.log(this.$refs);
      this.doRules(this.$refs[ref]).then(() => {
        if (this.id) this.form.id = this.id;

        this.$http
          .post(
            this.id
              ? "/index.php/index/Userinfo/hdedittj"
              : "/index.php/index/Userinfo/hdadd",
            this.form
          )
          .then((data) => {
            console.log(data);
            this.modalState = false;
            ElMessage({
              message: this.id ? "编辑成功" : "新增成功",
              type: "success",
            });
            this.getData();
          });
      });
    },
	editmsg(data){
		this.beizu=data.row.beizu;
		this.id=data.row.id;
		this.msgshow=true;
	},
    remove(data) {
      this.$http
        .post("/index.php/index/goodses/sjxcxdel", { id: data.row.id })
        .then((data) => {
          ElMessage({
            message: "删除成功",
            type: "success",
          });
          this.getData();
        });
    },
    handleAvatarSuccess(file) {
      this.form.image = file.data;
    },
  },
};
</script>
